﻿<TabItem x:Class="Antix.Mail.Smtp.Impostor.Client.HostTabItem"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:local="clr-namespace:Antix.Mail.Smtp.Impostor.Client">
    <TabItem.Header>
        <StackPanel Orientation="Horizontal">
            <Image Name="HostStatusImage" Source="{StaticResource StoppedImage}" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="None" Margin="3" />
            <TextBlock>
                <TextBlock Name="HostControl">0.0.0.0:25</TextBlock>
                (<TextBlock Name="HostMessageCount">0</TextBlock>)
            </TextBlock>
            <Image Name="HostSettingsImage" Source="{StaticResource SettingsImage}" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="None" Margin="1" />
            <Image Name="HostCloseImage" Source="{StaticResource CloseImage}" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="None" Margin="1" />
        </StackPanel>
    </TabItem.Header>
    <Grid
            Width="Auto" Height="Auto" Margin="0,0,0,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid Name="SettingsControl"
                  Grid.Row="0"
                  Width="Auto" Height="Auto"
                  Visibility="Collapsed">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="100" />
                <ColumnDefinition Width="150" />
                <ColumnDefinition Width="50" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <Label Content="Host" Grid.Column="0" Grid.Row="0" Style="{StaticResource labelStyle}" />
            <TextBox Name="IPAddressEditControl" Grid.Column="1" Grid.Row="0" Width="140" Style="{StaticResource textStyle}">
                <TextBox.Text>
                    <Binding Path="IPAddressString">
                        <Binding.ValidationRules>
                            <local:IPAddressValidationRule />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>

            <Label Content="Port" Grid.Column="2" Grid.Row="0" Style="{StaticResource labelStyle}" />
            <TextBox Name="PortEditControl" Grid.Column="3" Grid.Row="0" Width="50" Style="{StaticResource textStyle}">
                <TextBox.Text>
                    <Binding Path="Port">
                        <Binding.ValidationRules>
                            <local:PortValidationRule />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>

            <Label Content="Name" Grid.Column="0" Grid.Row="1" Style="{StaticResource labelStyle}" />
            <TextBox Name="NameEditControl" Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="1" Width="300" Style="{StaticResource textStyle}"
                     Text="{Binding Name}"/>

            <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="2">
                <Button Name="HostSettingsApplyButton" Width="100" Style="{StaticResource buttonStyle}" Content="Apply" />
                <Label Name="HostSettingsStatusControl" />
            </StackPanel>
            <Button Name="OpenFolderButton" Width="100"
                     Grid.Column="3" Grid.Row="2" Style="{StaticResource buttonStyle}" Content="Open Folder ..." />
        </Grid>
        <ListView Name="MessagesControl"
                  Grid.Row="1"
                    Width="Auto" Height="Auto" BorderThickness="0"
                    GridViewColumnHeader.Click="MessagesControl_Click" Focusable="False">
            <ListView.View>
                <GridView>
                    <GridViewColumn Width="125" Header="Received" DisplayMemberBinding="{Binding ReceivedOn}" HeaderTemplate="{StaticResource columnHeader}" HeaderContainerStyle="{StaticResource columnHeaderStyle}" />
                    <GridViewColumn Width="Auto" Header="Subject" DisplayMemberBinding="{Binding Subject}" HeaderTemplate="{StaticResource columnHeader}" HeaderContainerStyle="{StaticResource columnHeaderStyle}" />
                    <GridViewColumn Width="Auto" Header="To" DisplayMemberBinding="{Binding To}" HeaderTemplate="{StaticResource columnHeader}" HeaderContainerStyle="{StaticResource columnHeaderStyle}" />
                    <GridViewColumn Width="Auto" Header="From" DisplayMemberBinding="{Binding From}" HeaderTemplate="{StaticResource columnHeader}" HeaderContainerStyle="{StaticResource columnHeaderStyle}" />
                </GridView>
            </ListView.View>
        </ListView>
        <StatusBar Name="StatusBar" Grid.Row="2"
                   Width="Auto" Height="23"
                   VerticalAlignment="Bottom"
                   Margin="1">
            <TextBlock Name="StatusControl" />
        </StatusBar>
    </Grid>
</TabItem>
